﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Needle.Simulation;

namespace Needle.Simulation
{
    public class Ticker : Process
    {

        public Ticker(TimeSpan interval)
        {
            _Interval = interval;
        }

        private TimeSpan _Interval;
        public TimeSpan Interval
        {
            get { return _Interval; }
            set { _Interval = value; }
        }

        protected override IEnumerable<Task> ProcessDefinition()
        {
            while (true)
            {
                yield return RaiseEvent("Tick");
                yield return Delay(Interval);
            }
        }
    }
}
